import type { object_Inf } from "@/utils/typings/index.type";
import request from "@/utils/request";
import moldManage_APi from "../moldManage";
/*
 * @Descripttion:组织管理接口类
 * @LastEditors: xzh
 * @LastEditTime: 2023-09-09 10:21:56
 */
export default class organizeManage_APi extends moldManage_APi {
  //#region 部门管理接口

  /**
   * @Author: xzh
   * @Descripttion:保存部门信息
   * @Param:
   * @param {object} data
   */
  static saveDepartment = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/Organization/SaveOrganization",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除部门信息
   * @Param:
   * @param {Array} data
   */
  static deleteDepartment = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/Organization/DeleteOrganization",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改部门状态
   * @Param:
   * @param {Array} data
   */
  static updateDepartmentStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/Organization/UpdateOrganizationStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取部门信息
   * @Param:
   * @param {number} id 部门主键
   */
  static getDepartmentInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/Organization/GetorganizationInfo",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取部门列表
   * @Param:
   */
  static getDepartmentList = (
    data: object_Inf = {
      keyword: "",
    }
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/Organization/GetOrganizationList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion

  //#region 岗位管理接口

  /**
   * @Author: xzh
   * @Descripttion:保存岗位信息
   * @Param:
   * @param {object} data
   */
  static savePostment = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/JobPost/SaveJobPost",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除岗位信息
   * @Param:
   * @param {Array} data
   */
  static deletePostment = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/JobPost/DeleteJobPost",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改岗位状态
   * @Param:
   * @param {Array} data
   */
  static updatePostmentStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/JobPost/UpdateJobPostStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取岗位信息
   * @Param:
   * @param {number} id 岗位主键
   */
  static getPostmentInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/JobPost/GetJobPostInfo",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取岗位列表
   * @Param:
   */
  static getPostmentList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/JobPost/GetJobPostList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion

  //#region 角色管理接口

  /**
   * @Author: xzh
   * @Descripttion:保存角色信息
   * @Param:
   * @param {object} data
   */
  static saveRoletment = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/Role/SaveRole",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除角色信息
   * @Param:
   * @param {Array} data
   */
  static deleteRolement = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/Role/DeleteRole",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改角色状态
   * @Param:
   * @param {Array} data
   */
  static updateRolementStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/Role/UpdateRoleStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取角色信息
   * @Param:
   * @param {number} id 角色主键
   */
  static getRolementInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/Role/GetRoleInfo",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取角色列表
   * @Param:
   */
  static getRolementList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/Role/GetRoleList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 保存角色权限设置
   * @Param:
   * @param {object} data
   */
  static saveRolePowerSet = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/Permission/SavePermission",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取角色权限设置信息
   * @Param:
   * @param {number} roleId 角色主键
   */
  static getRolePowerSetInfo = (roleId: number): Promise<object_Inf> =>
    request({
      url: "/api/Permission/GetPermissionByRoleId",
      method: "get",
      params: { roleId },
    });

  //#endregion

  //#region 人员管理接口

  /**
   * @Author: xzh
   * @Descripttion:保存人员信息
   * @Param:
   * @param {object} data
   */
  static saveUser = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/User/SaveUser",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除人员信息
   * @Param:
   * @param {Array} data
   */
  static deleteUser = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/User/DeleteUser",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改人员状态
   * @Param:
   * @param {Array} data
   */
  static updateUserStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/User/UpdateUserStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 重置密码
   * @Param:
   * @param {Array} data
   */
  static resetPassword = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/User/ResetPassword",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取人员信息
   * @Param:
   * @param {number} id 人员主键
   */
  static getUserInfoById = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/User/GetUserInfo",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion: 批量获取人员信息
   * @Param:
   * @param {number} data 人员主键
   */
  static getUserInfoByIds = (data: Array<number>): Promise<object_Inf> =>
    request({
      url: "/api/User/GetUserListByIds",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 根据部门主键获取人员信息
   * @Param:
   * @param {number} departId 部门主键
   */
  static getUserInfoByDepartId = (departId: number): Promise<object_Inf> =>
    request({
      url: "/api/User/GetUserListByOrgId",
      method: "get",
      params: { orgId: departId },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取人员列表
   * @Param:
   */
  static getUserList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/User/GetUserList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  /**
   * @Author: xzh
   * @Descripttion:获取部门人员树
   * @Param:
   */
  static getDepartUserTree = (name: string = ""): Promise<Array<object_Inf>> =>
    request({
      url: "/api/User/GetUserTree",
      method: "get",
      // params: { name },
    });

  //#endregion
}
